import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PartyVO, PartyForm, PartyQuery } from '@/api/biz/party/types';

/**
 * 查询党组织列表
 * @param query
 * @returns {*}
 */

export const listParty = (query?: PartyQuery): AxiosPromise<PartyVO[]> => {
  return request({
    url: '/biz/party/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询党组织详细
 * @param id
 */
export const getParty = (id: string | number): AxiosPromise<PartyVO> => {
  return request({
    url: '/biz/party/' + id,
    method: 'get'
  });
};

/**
 * 新增党组织
 * @param data
 */
export const addParty = (data: PartyForm) => {
  return request({
    url: '/biz/party',
    method: 'post',
    data: data
  });
};

/**
 * 修改党组织
 * @param data
 */
export const updateParty = (data: PartyForm) => {
  return request({
    url: '/biz/party',
    method: 'put',
    data: data
  });
};

/**
 * 删除党组织
 * @param id
 */
export const delParty = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/party/' + id,
    method: 'delete'
  });
};
